package com.gxt.riaapp.server;

import javax.servlet.http.HttpSession;

import com.gxt.riaapp.client.RiaAppPgmService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class RiaAppPgmServiceImpl extends RemoteServiceServlet implements RiaAppPgmService {
	private HttpSession getSession() {
		return this.getThreadLocalRequest().getSession();
	}
	@Override
	public void getSessionData() throws Throwable {
		HttpSession session = getSession();
		if( null == session.getAttribute("loginid")) // index.html페이지에서 전달해주고 loginChk.jsp에서 생성한 세션정보
			throw new Throwable("세션이 종료되었습니다.");
		else{
			System.out.println("로그인 아이디는 : "+(String)session.getAttribute("loginid"));
			System.out.println("세션 생성시간 : "+ new java.util.Date(session.getCreationTime()) );
			System.out.println("설정된 세션유지시간: "+ session.getMaxInactiveInterval()/60);
			System.out.println("마지막 AccessTime :"+ new java.util.Date(session.getLastAccessedTime()));
			
			
			System.out.println("----------------------------------------------");
		}
	}
}
